package docker

import (
	"fmt"
	"github.com/docker/docker/client"
	"github.com/tluo-github/super-runner/common"
)

func GetDockerClient(config common.Docker) *client.Client {
	cli, err := client.NewEnvClient()
	if err != nil {
		return nil
	}
	return cli
}
func IsErrNotFound(err error) bool {
	return client.IsErrNotFound(err)
}

func BuildVariables(bv common.JobVariables) []string {
	if bv == nil{
		return nil
	}
	var envs []string

	for _, m  := range bv {
		env := fmt.Sprintf("%s=%s",m.Key,m.Value )
		envs = append(envs, env)
	}
	return envs
}